package list;

public class Test {
    public static void main(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add(1);
        myArrayList.add(2);
        myArrayList.add(3);
        myArrayList.add(4);
        myArrayList.add(5);
        myArrayList.add(6);

        int ret = myArrayList.get(2);
        System.out.println("2下标的值为: " + ret);

        myArrayList.set(4,55);

        myArrayList.remove(1);

        System.out.println(myArrayList.size());

        myArrayList.display();

        myArrayList.clear();

        System.out.println(myArrayList.size());
        myArrayList.display();
    }
    public static void main3(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add(1);
        myArrayList.add(2);
        myArrayList.add(3);
        myArrayList.add(4);
        myArrayList.add(5);
        myArrayList.add(6);

        if (myArrayList.contains(2)) {
            System.out.println("找到了");
        }else {
            System.out.println("没有找到");
        }

        int index = myArrayList.indexOf(2);
        System.out.println("找到了下标为: " + index);

        myArrayList.display();
    }
    public static void main2(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add(1);
        myArrayList.add(2);
        myArrayList.add(3);
        myArrayList.add(4);
        myArrayList.add(5);
        myArrayList.add(6);
        myArrayList.add(8,25);
        myArrayList.display();
    }
    public static void main1(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        IList list = new MyArrayList();

        myArrayList.display();
        list.display();
    }
}
